<template>
  <div class="sy">
    <!-- 头部 -->
    <div class="navbar">
      <van-nav-bar :border="false" @click-left="$router.push('/mine')">
        <template #title> <span class="fsbu">我的点赞</span> </template>
        <template #left>
          <van-icon name="arrow-left" size="18px" />
        </template>
      </van-nav-bar>
    </div>
    <!-- 送养详情 -->
    <div id="box">
      <div id="id" v-for="mub in item" :key="mub.cmid">
        <router-link :to="`/redetail/${mub.mid}`">
          <nearPet
            :imgname="mub.imgname"
            :label="mub.label"
            :site="mub.site"
            :title="mub.title"
          />
        </router-link>
        <van-icon name="delete-o" id="aa" @click="submit(mub.mid, mub.title)" />
      </div>
    </div>
  </div>
</template>

<script>
import { getLove, delLove } from "@/api/ycmj";
import nearPet from "@/components/nearPet.vue";
import { Dialog } from "vant";
export default {
  data() {
    return {
      item: [],
      info: "",
      tit: "",
    };
  },

  methods: {
    submit(information, tii) {
      this.info = information;
      this.tit = tii;
      console.log(this.info);
      delLove({
        uid: this.$store.state.user.uid,
        mid: this.info,
        title: this.tit,
      }).then((res) => {
        console.log(res);
        if (res.data.status == 200) {
          Dialog({ message: "删除成功" });
          this.a();
        }
      });
    },
    async a() {
      const data = await getLove({ uid: this.$store.state.user.uid });
      this.item = data.data.message;
      console.log(11111);
      console.log(this.item);
    },
  },
  mounted() {
    this.a();
  },
  components: {
    nearPet,
  },
};
</script>

<style lang="scss" scoped>
#box {
  height: calc(100% - 94px);
  display: flex;
  flex-wrap: wrap;
  text-align: left;
  margin-left: 6px;
}
#id {
  margin: 0 8px;
  > #aa {
    font-size: 24px;
    position: relative;
    bottom: 55px;
    left: 120px;
    color: #fbe397;
  }
}

.van-nav-bar {
  ::v-deep .van-icon {
    color: black;
  }
  ::v-deep .van-nav-bar__title {
    font-weight: bold;
    font-family: "黑体";
  }
}
</style>
